import React, { Component } from 'react';
import { View } from '@tarojs/components'
import Taro, { getCurrentInstance } from '@tarojs/taro'
import { timestampToTime, transformData } from '@/utils'
import { SpNavBar } from '@/components'
import api from '@/api'
import { AtList, AtListItem } from "taro-ui"
import './editList.scss'
class EditList extends Component {
    constructor(props) {
        super(props);
    }
    state = {
        id: '',
    }

    async componentDidMount () {
        const {
            router: {
                params: { id }
            }
        } = getCurrentInstance()
         this.setState({ id: id })
    }
    navigateToGoodForm = async() => {
      
        if (this.state.id) {
            Taro.navigateTo({
                url: `/pages/shop/form?id=${this.state.id}`
            })
            return
        }

    }
    render() {
        return (
            <>
                <SpNavBar title='编辑店铺'></SpNavBar>
                <AtList className='edit-list'>
                    <AtListItem title='基础信息' note='设置基础信息' arrow='right' onClick={this.navigateToGoodForm} />
                    <AtListItem title='店铺位置' note='设置店铺详细位置' arrow='right' onClick={() => {
                        Taro.navigateTo({
                            url: `pages/shop/edit/editLocation?id=${this.state.id}`
                        })
                    }} />
                    <AtListItem title='到店退货' note='设置到店退货' arrow='right' onClick={() => {
                        Taro.navigateTo({
                            url: `/pages/shop/edit/editTuihuo?id=${this.state.id}`
                        })
                    }} />
                </AtList>
            </>

        );
    }
}

export default EditList;